import { post, post2, get2 } from '@/utils/request'
import axios from 'axios'


/**
 * 预备出题知识点选择
 * @param data
 */
export function fetchKnowledge(id) {
  return axios.get('http://111.63.183.17:5000/get_knowledge?course_id=' + id)
}


/**
 * 题库详情
 * @param data
 */
export function fetchDetail(id) {
  return post('/api/exam/exam/detail', { id: id })
}

/**
 * 简略详情
 * @param data
 */
export function simpleDetail(id) {
  return post('/api/exam/exam/simple-detail', { id: id })
}

/**
 * 保存题库
 * @param data
 */
export function saveData(data) {
  return post('/api/exam/exam/save', data)
}

/**
 * 保存题目
 * @param data
 */
export function saveQuestionData(courseId, data) {
  return post('/api/qu/qu/save?courseId=' + courseId, data)
}


/**
 * 题库详情
 * @param data
 */
export function fetchList(data) {
  return post('/api/exam/exam/paging', data)
}

/**
 * 校验考试信息
 * @param id
 * @returns {*}
 */
export function checkInfo(id) {
  return post('/api/exam/exam/check-info', { id: id })
}


/**
 * 发送考试安排
 * @param data
 * @returns {Promise}
 */
export function prepareNotify(data) {
  return post('/api/exam/exam/prepare-notify', data)
}

/**
 * 创建预付费订单
 * @param id
 * @returns {Promise}
 */
export function buy(refId) {
  return post('/api/exam/exam/buy', { refId: refId })
}
